<template>
    <div class="container" v-if="store.isNotice">
        <div class="add">
            <h3> 发布公告 </h3>
        </div>
        <el-divider />
        <el-form label-width="auto" style="max-width: 600px">
            <el-form-item label="公告类型 : ">
                <el-input placeholder="请输入公共类型" v-model="store.textType" />
            </el-form-item>
            <el-form-item label="公告内容 : ">
                <el-input type="textarea" :rows="6" placeholder="请输入详细内容" v-model="store.textDetail" />
            </el-form-item>
            <el-form-item label="发布时间 : ">
                <el-col :span="11">
                    <el-date-picker v-model="store.textDate" type="date" placeholder="Pick a date"
                        style="width: 100%" />
                </el-col>
                <el-col :span="1" class="text-center">
                    <span class="text-gray-500">---</span>
                </el-col>
                <el-col :span="11">
                    <el-time-picker v-model="store.textDateNow" placeholder="Pick a time" style="width: 100%" />
                </el-col>
            </el-form-item>
            <el-form-item>
                <div class="btn">
                    <el-button type="primary" @click="okNotice">确认发布</el-button>
                    <el-button type="danger" @click="canelNotice">取消发布</el-button>
                </div>
            </el-form-item>
        </el-form>
    </div>
</template>

<script setup>
import { ref } from 'vue';
import { mapStore } from '@/store';
import { addNotice } from '@/hooks/addNoticeHook';
const { okNotice, canelNotice } = addNotice()

const store = mapStore()
const date = ref('')
</script>

<style scoped lang="scss">
.container {
    position: fixed;
    top: 20%;
    left: 30%;
    z-index: 1000;
    border: solid 12px #99999979;
    border-radius: 10px;
    background: #fff;
    width: 600px;
    height: 500px;

    .add {
        height: 50px;
        background: rgba(135, 207, 235, 0.667);

        h3 {
            color: #fff;
            text-align: center;
            line-height: 50px;
        }
    }

    .el-form {
        padding: 20px;

        .btn {
            margin: auto;
        }
    }
}
</style>
